<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>出院管理</title>
    <link rel="stylesheet" href="../..//lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <form class="layui-form" action="" style="padding:20px;">
            <div style="text-align: center;margin: 10px 10px 20px 30px;line-height: 50px">
                <label class="layui-row" id="sel_state" style="font-family: 仿宋; font-size: 20px; color: #000000">出院信息</label>
            </div>
            <div class="layui-form-item">

                <label class="layui-form-label">患者姓名:</label>
                <div class="layui-input-inline">
                    <input type="text" name="pname" placeholder="请输入" autocomplete="off" class="layui-input" id="pname">
                </div>
                <div class="layui-input-inline">
                    <button type="submit" class="layui-btn layui-btn-primary" lay-submit  lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                </div>
            </div>

        </form>


            <div class="layui-btn-container">
                <button class="layui-btn layui-btn-sm data-add-btn"> 添加出院信息 </button>
            </div>

        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>


    </div>
</div>

<script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="../../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    layui.use(['table', 'form'], function () {
        //开始使用

        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            layuimini = layui.layuimini;


        var userInfo = layui.data('userInfo');

        //加载信息
        table.render({
            elem: '#currentTableId',
            url: 'http://localhost:8080/out/findAll',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {type: "checkbox", minwidth: 50, fixed: "left"},
                {field: 'oid', minwidth: 80, title: '出院id'},
                {field: 'pid', minwidth: 80, title: '患者id'},
                {field: 'pname', minwidth: 80, title: '患者姓名'},
                {field: 'page', minwidth: 80, title: '患者年龄'},
                {field: 'psex', minwidth: 80, title: '患者性别'},
                {field: 'beds', minwidth: 80, title: '床位'},
                {field: 'odate', minwidth: 80, title: '出院时间'},
                {field: 'supplementary', minwidth: 80, title: '补交款'},
                {field: 'refund', minwidth: 80, title: '退还款'}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var field = data.field;

            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where: {
                    pname:field.pname
                }//这里传参  向后台
                , url: 'http://localhost:8080/out/findAllname'//后台做模糊搜索接口路径
                , method: 'get'
            }, 'data');

            return false;
        });

        // 监听添加操作
        $(".data-add-btn").on("click", function () {

            var index = layer.open({
                title: '添加入院信息',
                type: 2,
                shade: 0.2,
                maxmin:true,
                shadeClose: true,
                area: ['100%', '100%'],
                content: './other/add_outhospital.html',
            });
            $(window).on("resize", function () {
                layer.full(index);
            });

            return false;
        });

    });
</script>
</body>
</html>